package com.xy.xylive.service.impl;

import java.util.Date;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.xy.xylive.mapper.AudienceMapper;
import com.xy.xylive.domain.Audience;
import com.xy.xylive.service.IAudienceService;

/**
 * 观众Service业务层处理
 * 
 * @author ghostsf
 * @date 2024-05-19
 */
@Service
public class AudienceServiceImpl implements IAudienceService 
{
    @Autowired
    private AudienceMapper audienceMapper;

    /**
     * 查询观众
     * 
     * @param id 观众主键
     * @return 观众
     */
    @Override
    public Audience selectAudienceById(Integer id)
    {
        return audienceMapper.selectAudienceById(id);
    }

    /**
     * 查询观众列表
     * 
     * @param audience 观众
     * @return 观众
     */
    @Override
    public List<Audience> selectAudienceList(Audience audience)
    {
        return audienceMapper.selectAudienceList(audience);
    }

    /**
     * 新增观众
     * 
     * @param audience 观众
     * @return 结果
     */
    @Override
    public int insertAudience(Audience audience)
    {
        audience.setCreateTime(new Date());
        return audienceMapper.insertAudience(audience);
    }

    /**
     * 修改观众
     * 
     * @param audience 观众
     * @return 结果
     */
    @Override
    public int updateAudience(Audience audience)
    {
        audience.setUpdateTime(new Date());
        return audienceMapper.updateAudience(audience);
    }

    /**
     * 批量删除观众
     * 
     * @param ids 需要删除的观众主键
     * @return 结果
     */
    @Override
    public int deleteAudienceByIds(Integer[] ids)
    {
        return audienceMapper.deleteAudienceByIds(ids);
    }

    /**
     * 删除观众信息
     * 
     * @param id 观众主键
     * @return 结果
     */
    @Override
    public int deleteAudienceById(Integer id)
    {
        return audienceMapper.deleteAudienceById(id);
    }
}
